package com.coolpad.Utils;


public class BitOperationUtils {
    public BitOperationUtils() {
    }

    public static int updateBitsValue(int origValue, int offset, boolean value) {
        int updatedValue;
        if (value) {
            updatedValue = origValue | 1 << offset;
        } else {
            updatedValue = origValue & ~(1 << offset);
        }

        return updatedValue;
    }

    public static boolean isBitSet(int checkedValue, int offset) {
        return (checkedValue & 1 << offset) != 0;
    }
}

